/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package newpackage;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Juan
 */
@Entity
@Table(name = "TIPOCOSTO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tipocosto.findAll", query = "SELECT t FROM Tipocosto t"),
    @NamedQuery(name = "Tipocosto.findByCodTipoCosto", query = "SELECT t FROM Tipocosto t WHERE t.codTipoCosto = :codTipoCosto"),
    @NamedQuery(name = "Tipocosto.findByDescripcion", query = "SELECT t FROM Tipocosto t WHERE t.descripcion = :descripcion")})
public class Tipocosto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CodTipoCosto")
    private Integer codTipoCosto;
    @Column(name = "Descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipocosto")
    private Collection<Detallecosto> detallecostoCollection;

    public Tipocosto() {
    }

    public Tipocosto(Integer codTipoCosto) {
        this.codTipoCosto = codTipoCosto;
    }

    public Integer getCodTipoCosto() {
        return codTipoCosto;
    }

    public void setCodTipoCosto(Integer codTipoCosto) {
        this.codTipoCosto = codTipoCosto;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    @JsonIgnore
    public Collection<Detallecosto> getDetallecostoCollection() {
        return detallecostoCollection;
    }

    public void setDetallecostoCollection(Collection<Detallecosto> detallecostoCollection) {
        this.detallecostoCollection = detallecostoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTipoCosto != null ? codTipoCosto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipocosto)) {
            return false;
        }
        Tipocosto other = (Tipocosto) object;
        if ((this.codTipoCosto == null && other.codTipoCosto != null) || (this.codTipoCosto != null && !this.codTipoCosto.equals(other.codTipoCosto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "newpackage.Tipocosto[ codTipoCosto=" + codTipoCosto + " ]";
    }
    
}
